#include				"async.h"

Async::Async()
{

}

Async::~Async()
{

}

boost::asio::io_service	&Async::getService()
{
	return _io_service;
}

void					Async::start()
{
	int cores_number = boost::thread::hardware_concurrency();
	if (!cores_number)
		cores_number = 1;
	for (int i = 0; i < cores_number; ++i)
		_threads.create_thread(boost::bind(&boost::asio::io_service::run, &_io_service));
}

void					Async::wait()
{
	_threads.join_all();
}

void					Async::close()
{
	_io_service.stop();
}